/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package measure2;

import com.ericsson.nfc.signing.algorithm.PrivateKey;
import com.ericsson.nfc.signing.certificate.X509Certificate;
import com.ericsson.nfc.signing.record.CertificateBytes;
import java.io.IOException;

/**
 *
 * @author emarkki
 */
public class Cert {
    
    private String title;
    
    private PrivateKey privateKey;
    private X509Certificate[] chain;
    private CertificateBytes[] chainBytes;
    private int keyAlgorithm;
    public static final int KEY_RSA = 0;
    public static final int KEY_DSA = 1;
    public static final int KEY_ECDSA = 2;

    public Cert(String title, PrivateKey privateKey, int keyAlgorithm, X509Certificate[] chain) throws IOException {
        this.title = title;
        this.privateKey = privateKey;
        this.keyAlgorithm = keyAlgorithm;
        this.chain = chain;
        this.chainBytes = new CertificateBytes[chain.length];
        for(int i = 0; i < chainBytes.length; i++) {
            chainBytes[i] = new CertificateBytes(chain[i].getBytes());
        }
    }

    public String getTitle() {
        return title;
    }

    public PrivateKey getPrivateKey() {
        return privateKey;
    }

    public int getKeyAlgorithm() {
        return keyAlgorithm;
    }
    
    public X509Certificate[] getChain() {
        return chain;
    }

    public CertificateBytes[] getChainBytes() {
        return chainBytes;
    }
    
}
